<template>
  <div class="content">
    <router-view></router-view>
    <van-tabbar @change="changeTab" active-color="red" v-model="active">
      <van-tabbar-item name="home" icon="home-o">主页</van-tabbar-item>
      <van-tabbar-item name="chat" icon="chat-o">聊天</van-tabbar-item>
      <van-tabbar-item name="mailbox" icon="envelop-o">信箱</van-tabbar-item>
      <van-tabbar-item name="info" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import api from "@/api/api";
export default {
  data() {
    return {
      active: 'home',
    }
  },
  methods:{
    changeTab(index){
      this.$router.replace(`/index/${index}`)
    }
  },
  beforeDestroy() {
    api.exit()
  }
}
</script>

<style scoped>

</style>